<template>
  <div class="lyric">
    <div class="music-info">
      <dl>
        <dt>
          <img :src="getCurrentMusic ? getCurrentMusic.image : noMusicPic">
        </dt>
        <dd>{{ song }}</dd>
        <dd>{{ singer }}</dd>
        <dd>{{ album }}</dd>
      </dl>
    </div>
    <div class="music-lyric" v-if="isLyric">
      
    </div>
    <div class="no-lyric" v-else>
      <p>
        还没有播放音乐哦。
      </p>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'lyric',
  data() {
    return {
      noMusicPic: require('../assets/image/player_cover.png'),
      isLyric: false
    }
  },
  computed: {
    song() {
      this.getCurrentMusic ? '歌曲名：' + this.getCurrentMusic.name : 'myMusic音乐播放器'
    },
    singer() {
      this.getCurrentMusic ? '歌手名：' + this.getCurrentMusic.singer : ''
    },
    album() {
      this.getCurrentMusic ? '专辑名：' + this.getCurrentMusic.album : ''
    },
    ...mapGetters(['getCurrentMusic'])
  }
}
</script>

<style lang="scss" scoped>
.lyric {
  height: 100%;
  text-align: center;
  font-size: $font_size_medium;
  .music-info {
    dt {
      position: relative;
      margin: 0 auto 15px;
      width: 186px;
      height: 186px;
      &:after {
        content: '';
        position: absolute;
        left: 9px;
        top: 0;
        width: 201px;
        height: 180px;
        background: url('../assets/image/album_cover_player.png') 0 0 no-repeat;
      }
      img {
        vertical-align: middle;
        width: 186px;
        height: 186px;
      }
    }
    dd {
      margin-top: 10px;
    }
  }
  .music-lyric, .no-lyric {
    height: calc(100% - 200px);
  }
  .no-lyric {
    p {
      position: relative;
      top: 50%;
      transform: translateY(-50%);
    }
  }
}
</style>